<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!doctype html>
<html><!-- InstanceBegin template="/Templates/index.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="title" -->
<title>微笑墙</title>

<link rel="stylesheet" type="text/css" href="../css/index.css">
<link rel="shortcut icon" type="text/css" href="../images/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="css/smile.css">
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/simle.js"></script>
<script type="text/javascript">
	function s_login(){
		var email=$("#user_id").val();
		var pwd=$("#user_pwd").val();
		
		$.post("../json/userInfoAction_login",{"userInfo.w_email":email,"userInfo.w_pwd":pwd},function(data){
			if( data.result==1 ){
				$(".log_user").css("display","none");
				$(".log_user_info").css("display","none");
				location.href="smile.jsp";
			}
		},"json");
	}

	function getPage(pageNo){
		var liNo=$("#s_liNo").val();
		if(liNo == 1 ){
			$.post("../json/smileAction_pageSmile",{page:pageNo},function(data){
				var str="";
				$.each(data.rows,function(index,item){
						if(data.gid!=null){
						id=data.gid; //获取用户点赞过的图片id  1101,1102
						var temp=id.split(","); //把id分隔开
						
						str+='<li><img id='+item.sid+' src="../'+item.saddr+'" /><div id="smile_zan" class="smile_zan">';
						str+='<div id="smile_zan_di" class="smile_zan_di"></div><div id="smile_zan_zan" class="smile_zan_zan">';
						
						
						if(id.indexOf(item.sid)!=-1){
							str+='<img id='+item.sid+' src="images/like.ico"  />';
						}else{
							str+='<img id='+item.sid+' src="images/no_like.ico"  />';
						}
						str+='<a href="javascript:sdetails('+item.sid+')"><p>'+item.sname+'</p></a>';	
						str+='</div></div></li>';
					}else{
						str+='<li><img id='+item.sid+' src="../'+item.saddr+'" /><div id="smile_zan" class="smile_zan">';
						str+='<div id="smile_zan_di" class="smile_zan_di"></div><div id="smile_zan_zan" class="smile_zan_zan">';
						str+='<img id='+item.sid+' src="images/no_like.ico"  />';
						str+='<a href="javascript:sdetails('+item.sid+')"><p>'+item.sname+'</p></a>';	
						str+='</div></div></li>';
					}
				});
				$(".smile_content_content ul").html(str);

				//取分页
				var obj=data.obj;
				str1="<span>&nbsp&nbsp"+obj.pageNo+"&nbsp&nbsp</span>";
				str2="<span>&nbsp共&nbsp"+obj.totalPage+"&nbsp页 &nbsp</span>";
				$("#spage1").html("");
				$("#spage2").html("");
				$(str1).appendTo( $("#spage1"));
				$(str2).appendTo( $("#spage2"));
				
				s_show();
				
			},"json");
		}else if( liNo == "my" ){
			$.post("../json/smileAction_pageMySmile",{page:pageNo},function(data){
				var str="";
				$.each(data.rows,function(index,item){
						if(data.gid!=null){
						id=data.gid; //获取用户点赞过的图片id  1101,1102
						var temp=id.split(","); //把id分隔开
						
						str+='<li><img id='+item.sid+' src="../'+item.saddr+'" /><div id="smile_zan" class="smile_zan">';
						str+='<div id="smile_zan_di" class="smile_zan_di"></div><div id="smile_zan_zan" class="smile_zan_zan">';
						
						
						if(id.indexOf(item.sid)!=-1){
							str+='<img id='+item.sid+' src="images/like.ico"  />';
						}else{
							str+='<img id='+item.sid+' src="images/no_like.ico"  />';
						}
						str+='<a href="javascript:sdetails('+item.sid+')"><p>'+item.sname+'</p></a>';	
						str+='</div></div></li>';
					}else{
						str+='<li><img id='+item.sid+' src="../'+item.saddr+'" /><div id="smile_zan" class="smile_zan">';
						str+='<div id="smile_zan_di" class="smile_zan_di"></div><div id="smile_zan_zan" class="smile_zan_zan">';
						str+='<img id='+item.sid+' src="images/no_like.ico"  />';
						str+='<a href="javascript:sdetails('+item.sid+')"><p>'+item.sname+'</p></a>';	
						str+='</div></div></li>';
					}
				});
				$(".smile_content_content ul").html(str);

				//取分页
				var obj=data.obj;
				str1="<span>&nbsp&nbsp"+obj.pageNo+"&nbsp&nbsp</span>";
				str2="<span>&nbsp共&nbsp"+obj.totalPage+"&nbsp页 &nbsp</span>";
				$("#spage1").html("");
				$("#spage2").html("");
				$(str1).appendTo( $("#spage1"));
				$(str2).appendTo( $("#spage2"));
				
				s_show();
				
			},"json");
		}
		
		
	}
</script>

<!-- InstanceEndEditable -->
</head>

<body>
<!--头部开始-->
<div class="header">
<input id="s_liNo" type="hidden" value="1">
<input id="currentUser" name="smile.w_uid" type="hidden" value="${sessionScope.currentUser.w_uid}">
    <div class="logo">
        <a href="../index.html"><img src="../images/logo.png"></a>
    </div>
    <div class="nav">
        <ul>
            <li><a href="../index.jsp" class="tit">首页</a></li>
            <li><a href="javaScript:getInfo()" class="tit">心理FM</a></li>
            <li><a href="../moods/moods.jsp" class="tit">心情说</a></li>
            <li><a href="../article/article.jsp" class="tit">杂志</a></li>
           <!--  <li><a href="../test/test.jsp" class="tit">测试</a></li> -->
           <li><a href="#" class="tit">测试</a></li>
            <li><a href="smile.jsp" class="tit">微笑墙</a></li>
        </ul>
    </div>
    <div class="reg">
        <ul>
            <c:if test="${empty sessionScope.currentUser}">
	            <li><a href="../login/login.html" id="login_logo">登录</a></li>
	            <li><span class="line"></span></li>
	            <li><a href="../reg/reg.html" id="reg_logo">注册</a></li>
	       	</c:if>
	       	<c:if test="${!empty sessionScope.currentUser}">
	       		<li id="myli"><span>欢迎您</span>[<a href="userServlet?op=getPerInfo" style="color:yellow;font-size:12px;" id="user_email">${sessionScope.currentUser.w_email}</a>]
	       		<span id="myspan"></span>
	       		<div id="current_userInfo">
	       			<dl>
	       				<dd><a href="#">个人中心</a></dd>
	       				<dd><a href="#">发表说说</a></dd>
	       				<dd><a href="#">我的通知</a></dd>
	       				<dd><a href="exit.jsp">退&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;出</a></dd>
	       			</dl>
	       		</div>
	       		</li>
	       	</c:if>
        </ul>
    </div>
    <div class="sear">
        <form target="_blank" action="" method="get">
            <input type="text" class="text" name="sear" placeholder="搜索" />
            <input type="submit" class="submit" value="&#10140;"/>
        </form>
    </div>
</div>
<!--头部结束-->
<!-- InstanceBeginEditable name="content" -->
<div class="smile_content">
    	<div class="smile_content_nav">
        	<ul>
                <li class="smile_content_nav_hot"><a href="#">最热(24小时)</a> </li>
                <li class="smile_content_nav_new"><a href="#"> 最新 </a></li>
                <li class="smile_content_nav_mine"><a href="javascript:mysmile()"> 我的微笑 </a></li>
                <li class="smile_content_nav_photo"><a> 拍照/上传 </a></li>
        	</ul>
        </div>
        
        <div class="smile_content_content" id="smile_content_content">
        	<ul id="smile_ul">
         	
            	<!--<li>
                	<img src="images/43fabead41.jpg" />
                    <div id="smile_zan" class="smile_zan">
                        <div id="smile_zan_di" class="smile_zan_di"></div>
                       
                        <div id="smile_zan_zan" class="smile_zan_zan">
                            <img src="images/no_like.ico" />
                            <a href="simle_index.html"><p>可爱的孩子</p></a>
                        </div>
                    </div>
                </li> -->

               
            </ul>
            </div>
            
            <div class="smile_content_content_bottom">
            	<!-- <p id="smore"><a href="javascript:page()"><span>点击加载更多</span></a></p>-->
            	  
            	  <p><a href="javascript:getPage(3)"><span>首页&nbsp</span></a> 
            	 	<a href="javascript:getPage(1)"><span>上一页</span></a>  
            	 	<span id="spage1">&nbsp&nbsp&nbsp&nbsp</span> 
                 	<a href="javascript:getPage(2)"><span>下一页</span></a>  
                 	<span id="spage2">&nbsp共&nbsp&nbsp页 &nbsp${pageInfo.totalSize}条</span></p>
            </div>
        </div>
    </div>
    
    <div class="log_user"></div>
	<div class="log_user_info">
           <img class="log_user_info_del" src="images/log_del.jpg"/><br/>
           <h2  style="margin-left:40px; font-family:'微软雅黑';font-weight:400;">登录微心理</h2><br/>
           <form method="post" id="user_form">
           		<p class="user_p1"><label for="user_id">邮箱&nbsp;&nbsp;</label><input type="text" name="userInfo.w_email" id="user_id"/></p>
                <p class="user_p2"><label for="user_pad">密码&nbsp;&nbsp;</label><input type="password" name="userInfo.w_pwd" id="user_pad"/></p>
               <input type="button" onclick="s_login()" name="users" id="users" value="登录"/>
               <br/>
               <p class="user_forget"><a>>>忘记密码</a>&nbsp;&nbsp;<a>>>注册</a></p>
           </form>
      </div>
<!-- InstanceEndEditable -->
<!--内容部分结束-->
<div id="footer">
  <div id="footer_content">
       	<div id="nav">
            <ul>
                <li><a href="#">关于我们</a></li>
                <li><a href="#">加入我们</a></li>
                <li><a href="#">联系我们</a></li>
                <li><a href="#">免责声明</a></li>
                <li><a href="#">友情链接</a></li>
                <li><a href="#">网站地图</a></li>
                <li><a href="#">手机版</a></li>
                <li><a href="#">手机应用</a></li>
                <li><a href="#" style="display: none">投稿</a></li>
            </ul>
        </div>
        <div id="links">
            <span>友情链接：</span>
            <ul>
                <li><a target="_blank" href="http://www.nlp.cn/">NLP心理学</a></li>
                <li><a target="_blank" href="http://zhidao.baidu.com/daily/">百度知道日报</a></li>
                <li><a target="_blank" href="http://iask.fh21.com.cn/">飞华问医生</a></li>
                <li><a target="_blank" href="http://www.dxsbb.com/">大学生网</a></li>
                <li><a target="_blank" href="http://yuwen.chazidian.com/">语文网</a></li>
                <li><a target="_blank" href="http://tag.120ask.com/"> 有问必答知识库</a></li>
                <li><a target="_blank" href="http://www.xinli001.com/zx/">心理咨询</a></li>
                <li><a target="_blank" href="http://wannianli.tianqi.com/">天气网</a></li>
                <li><a target="_blank" href="http://www.pm25.com/">绿色呼吸</a></li>
                <li><a target="_blank" href="http://www.vmovier.com/">V电影</a></li>
                <li><a target="_blank" href="http://iask.sina.com.cn/c/79.html ">爱问健康</a></li>
            </ul>
        </div>
        <div id="copyright">
            <div id="footer_1">
                &copy; 2015 All Rights Reserved. <a target="_blank" href="http://www.miibeian.gov.cn/">粤ICP备12051153号</a>
            </div>
            <div id="footer_2">
                <a href="#">
                    <img src="../images/footer_pic1.png" align="absmiddle" />
                </a>
                <a href="#">
                    <img src="../images/footer_pic2.png" align="absmiddle" />
                </a>
            </div>
        </div>
    </div>
</div>
</body>
<!-- InstanceEnd --></html>

